import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import BillRecord from '@/views/bill/BillRecord'
import LendRecord from '@/views/lend/index'
import CovidRecord from '@/views/covid/index'
import Login from '@/views/Login'
import store from '@/store/index'



Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/Login',
      name: 'Login',
      component: Login
    },
    {
      path: '/HelloWorld',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/BillRecord',
      name: 'BillRecord',
      component: BillRecord
    },
    {
      path: '/LendRecord',
      name: 'LendRecord',
      component: LendRecord
    },
    {
      path: '/CovidRecord',
      name: 'CovidRecord',
      component: CovidRecord
    }
  ]
})

if (sessionStorage.getItem("token")){
  store.commit("set_token", sessionStorage.getItem("token"))
}
